<template>
  <view class="header">
    <view class="left">
      <view class="img">
        <image :src="data.avatar" mode="aspectFill"></image>
      </view>

      <view class="txt">
        <view class="name">
          {{ data.name }}
          <view class="tag" v-if="data.level_name">{{ data.level_name }}</view>
        </view>
        <view class="id">ID:{{ data.id }}</view>
      </view>
    </view>

    <view
      class="ewm"
      v-if="showEwm"
      @click="$utils.toUrl('/shareholder/shareholder/code')"
    >
      <i class="iconfont icon-QRcode"></i>
      <view>二维码</view>
      <i class="iconfont icon-arrow-right"></i>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    showEwm: {
      type: Boolean,
      default: false,
    },
    data: {
      type: Object,
      default() {
        return null;
      },
    },
  },

  data() {
    return {};
  },
};
</script>

<style lang="less" scoped>
.header {
  position: sticky;
  left: 0;
  top: 0;
  width: 100%;
  z-index: 4;
  display: flex;
  align-items: center;
  padding: 0 24rpx;
  height: 152rpx;
  background: #f0250e;

  .left {
    flex: 1;
    overflow: hidden;
    display: flex;
  }

  .name {
    display: flex;
    align-items: center;
    color: #fff;
  }

  .id {
    font-size: 24rpx;
    color: rgba(255, 255, 255, 0.8);
  }

  .tag {
    margin-left: 10rpx;
    padding: 2rpx 10rpx;
    font-size: 18rpx;
    border-radius: 32px;
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.94);
  }

  .img {
    width: 74rpx;
    height: 74rpx;
    border: 2rpx solid #fff;
    border-radius: 32px;

    image {
      height: 100%;
      width: 100%;
      border-radius: 32px;
    }
  }

  .txt {
    flex: 1;
    overflow: hidden;
    margin-left: 20rpx;
  }

  .ewm {
    display: flex;
    align-items: center;
    color: #fff;

    .icon-QRcode {
      font-size: 50rpx;
    }

    .icon-arrow-right {
      font-size: 18rpx;
    }
  }
}
</style>
